import { EntitySchema } from 'typeorm'

export const Frequency = new EntitySchema({
  name: 'Frequency',
  columns: {
    id: {
      primary: true,
      type: 'int',
      generated: true
    },
    // 时间戳 s
    createtime: {
      type: 'varchar'
    },
    // 时间戳 s
    updatetime: {
      type: 'varchar'
    },
    // 状态 1答题借书 2未结束中途退出 ， 0废弃
    status: {
      type: 'varchar'
    }
  },
  relations: {
    user: {
      target: 'User',
      type: 'many-to-one',
      joinColumn: true
    },
    answer: {
      target: 'Answer',
      type: 'one-to-many',
      inverseSide: 'frequency',
      joinColumn: true
    }
  }
})
